package cn.fl.ass.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.ass.vo.AssDealCarCostVO;
import cn.fl.ass.vo.AssDealCarVO;
import fl.ass.facade.dto.AssDealCarCostDTO;
import fl.ass.facade.dto.AssDealCarDTO;
import org.springframework.beans.BeanUtils;

/**
 * @Description: 处置-转优车费用信息表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class AssDealCarCostVOTransform {


	/**
	 * DTO 转  VO
	 * @param po AssDealCarCostDTO
	 * @return AssDealCarCostVO
	 */
	public static AssDealCarCostVO toVO(AssDealCarCostDTO dto) {
		AssDealCarCostVO  vo = null;
		if (dto != null) { 
			vo = new AssDealCarCostVO();
			BeanUtils.copyProperties(dto, vo);
			/*vo.setId(dto.getId());//主键
			vo.setCarId(dto.getCarId());//优车ID
			vo.setCostAmt(dto.getCostAmt());//费用金额
			vo.setCostRem(dto.getCostRem());//备注
			vo.setCostTypeCd(dto.getCostTypeCd());//费用项
			vo.setIsDel(dto.getIsDel());//是否删除
			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人*/
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto AssDealCarCostVO
	 * @return AssDealCarCostDTO
	 */
	public static AssDealCarCostDTO toDTO(AssDealCarCostVO vo) {
		AssDealCarCostDTO dto = null;
		if (vo != null) {
			dto = new AssDealCarCostDTO();
			BeanUtils.copyProperties(vo, dto);
			/*dto.setId(vo.getId());
			dto.setCarId(vo.getCarId());//优车ID
			dto.setCostAmt(vo.getCostAmt());//费用金额
			dto.setCostRem(vo.getCostRem());//备注
			dto.setCostTypeCd(vo.getCostTypeCd());//费用项
			dto.setIsDel(vo.getIsDel());//是否删除 1-删除 0-正常

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人*/
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<AssDealCarCostDTO>
	 * @return List<AssDealCarCostVO>
	 */
	public static List<AssDealCarCostVO> toVOList(List<AssDealCarCostDTO> list) {
		List<AssDealCarCostVO>  voList = new ArrayList<AssDealCarCostVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssDealCarCostDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<AssDealCarCostVO>
	 * @return List<AssDealCarCostDTO>
	 */
	public static List<AssDealCarCostDTO> toDTOList(List<AssDealCarCostVO> list) {
		List<AssDealCarCostDTO>  dtoList = new ArrayList<AssDealCarCostDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssDealCarCostVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
